package org.dromara.tearoom.domain.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import org.dromara.common.core.enums.ArrayValuable;

import java.util.Arrays;

/**
 * 是否类型
 *
 * @author ckj
 */
@AllArgsConstructor
@Getter
public enum YesOrNoEnum implements ArrayValuable<Integer> {

    NO(0, "否"),
    YES(1, "是");

    /**
     * 类型
     */
    private final Integer type;

    /**
     * 描述
     */
    private final String description;

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(YesOrNoEnum::getType).toArray(Integer[]::new);

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    /**
     * 判断是否是
     *
     * @param type 类型
     * @return 是否是
     */
    public static boolean isYes(Integer type) {
        return YES.getType().equals(type);
    }

}
